$(function () {
    // 判断token是否存在
    let res = localStorage.getItem("mytoken")
    if (res == null) {
        location.href = "./login.html"
    }

    // 退出按钮的点击事件
    let layer
    let form
    layui.use(['layer', 'form'], function () {
        layer = layui.layer
        form = layui.form
        $("#logout-btn").on("click", function () {
            layer.confirm("确定要退出吗？", function (index) {
                // 关闭弹窗
                layer.close(index)
                location.href = "./login.html"
                localStorage.removeItem("mytoken")
            })
        })
    })

})